<?php require_once(dirname(__FILE__) . '/inc/config.inc.php');
IsModelPriv('goodsorder');
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$tbname = '#@__user';
if ($id > 0) {
    $user_arr = $dosql->GetOne("select * from $tbname where id='$id'");
    if (is_array($user_arr) && isset($user_arr['id'])) {
        $user = $user_arr;
    } else {
        exit("id不存在");
    }
} else {
    exit("非法请求");
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>renl</title>
    <link href="templates/style/admin.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="templates/js/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->

    <link href="layui/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
    <script src="layui/layui.all.js"></script>
</head>
<body>


<style>
    .layui-upload-list img { max-width: 200px; height: auto;}
    .layui-form-label {
        float: left;
        display: block;
        padding: 9px ;
        width: 60px;
        font-weight: 400;
        line-height: 20px;
        text-align: right;
    }
    .layui-input-block {
        margin-left: 80px;
        min-height: 36px;
    }
</style>
<div class="layui-form " lay-filter="layuiadmin-form-tags" id="layuiadmin-app-form-tags">
    <div class="layui-form-item mt10">
        <label class="layui-form-label">id</label>
        <div class="layui-input-inline" style="height: 38px; line-height: 38px; color: darkred">
            <?php echo $user['id'] ?>
            <input type="hidden" name="id" id="id" value=" <?php echo $user['id'] ?>"/>


       昵称：<?php echo $user['nickname'] ?>
        </div>

    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-block">
            <div class="layui-upload">
                <img src="<?php echo $user['headimgurl'] ?>" width="100">


            </div>
        </div>

        <div class="layui-form-item mt10">
            <label class="layui-form-label">单位</label>
            <div class="layui-input-inline">
                <input type="text" name="school" value="<?php echo $user['school'] ?>" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="truename" value="<?php echo $user['truename'] ?>" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机</label>
            <div class="layui-input-inline">
                <input type="text" name="mobile" value="<?php echo $user['mobile'] ?>" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-block">
                <input type="text" name="address" value="<?php echo $user['address'] ?>" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户组</label>
            <div class="layui-input-block">
                <input name="level" type="radio" value="3" title="工程师" lay-filter="moshi" <?php  if($user['level']==3){echo 'checked=""';} ?> />
                <input name="level" type="radio" value="4" title="服务站" lay-filter="moshi" <?php  if($user['level']==4){echo 'checked=""';} ?>/>
                <input name="level" type="radio" value="6" title="用户" lay-filter="moshi" <?php  if($user['level']==6){echo 'checked=""';} ?>/>

            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">功能</label>
            <div class="layui-input-block">
                <input type="checkbox" name="qiang" lay-skin="switch"

                       lay-filter="component-form-switchTest" lay-text="可抢单|不可抢单" <?php if ($user['qiang'] == 1) {
                    echo "checked";
                } ?>>
                <input type="checkbox" name="isreport" lay-skin="switch"

                       lay-filter="component-form-switchTest" lay-text="报表显示|报表不显示" <?php if ($user['isreport'] == 1) {
                    echo "checked";
                } ?>>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">权限</label>
            <div class="layui-input-block">
                <input type="checkbox" name="isadmin" lay-skin="switch"

                       lay-filter="component-form-switchTest" lay-text="管理员|不是管理员" <?php if ($user['isadmin'] == 1) {
                    echo "checked";
                } ?>>
                <input type="checkbox" name="ispm" lay-skin="switch"

                       lay-filter="component-form-switchTest" lay-text="项目经理|不是项目经理" <?php if ($user['ispm'] == 1) {
                    echo "checked";
                } ?>>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline">
                <input type="button" lay-submit lay-filter="layuiadmin-app-tags-submit" value="确认" class="layui-btn">
            </div>
        </div>

    </div>
    <script>
        layui.use(['form', 'laydate', 'table', 'layedit', 'upload'], function () {
            var $ = layui.$,
                admin = layui.admin,
                element = layui.element,
                layer = layui.layer,
                view = layui.view,
                table = layui.table,
                laytpl = layui.laytpl,
                laydate = layui.laydate,
                layedit = layui.layedit,
                upload = layui.upload,
                form = layui.form;


            form.render(null, 'layuiadmin-form-tags');
            //监听提交
            form.on('submit(layuiadmin-app-tags-submit)', function (data) {
                var field = data.field; //获取提交的字段
                //提交 Ajax 成功后，关闭当前弹层并重载表格
                $.ajax({
                    url: "json/member/member_do.php",
                    data: {
                        "field": field,
                        "action": 'update'
                    },
                    type: "POST",
                    dataType: "json",
                    success: function (res) {
                        console.log(res);
                        if (res.code == 0) {
                            console.log("返回成功");
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        }

                    }
                });
            });

        });
    </script>
</body>
</html>